// UeResbuf.h: interface for the UeResbuf class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_UERESBUF_H__0BB18EB9_9698_4379_A1CF_2FA587A86593__INCLUDED_)
#define AFX_UERESBUF_H__0BB18EB9_9698_4379_A1CF_2FA587A86593__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "adsdef.h"

class AFX_EXT_CLASS UeResbuf  
{
public:
	UeResbuf();
	UeResbuf(struct resbuf* pRb);
	~UeResbuf();

public:
	UeResbuf& operator=(struct resbuf* buf);
	UeResbuf& operator=(struct resbuf& buf);
	void Add(struct resbuf* buf);
	void Add(struct resbuf& buf);
	
public:
	UeResbuf* Next() const {
		return rbnext;
	}

	void Next(UeResbuf* pBuf){
		SetNext(pBuf);
	}

	short Restype() const {
		return restype;
	}
	
	void Restype(short nType){
		if(this->restype == RTSTR)
			free(this->resval.rstring);
		restype = nType;
	}

public:
	void SetNext(UeResbuf* pNext){
		delete rbnext;
		rbnext = pNext;
	}

public:
	union ads_u_val {
		ads_real rreal;
		ads_real rpoint[3];
		short rint;
		char *rstring;
		long rlname[2];
		long rlong;   
		struct ads_binary rbinary;
		unsigned char ihandle[8];
	}; 

private:
	UeResbuf *rbnext; 
	short restype;

public:
	union ads_u_val resval;
};

#endif // !defined(AFX_UERESBUF_H__0BB18EB9_9698_4379_A1CF_2FA587A86593__INCLUDED_)
